<!DOCTYPE html>
<html lang="zh-cn">
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>{$CONF['mallTitle']}后台管理中心</title>
      <link href="__PUBLIC__/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
      <link href="__CSS__/AdminLTE.css" rel="stylesheet" type="text/css" />
      <!--[if lt IE 9]>
      <script src="__PUBLIC__/js/html5shiv.min.js"></script>
      <script src="__PUBLIC__/js/respond.min.js"></script>
      <![endif]-->
      <script src="__PUBLIC__/js/jquery.min.js"></script>
      <script src="__PUBLIC__/plugins/bootstrap/js/bootstrap.min.js"></script>
      <script src="__PUBLIC__/js/common.js"></script>
      <script src="__PUBLIC__/plugins/plugins/plugins.js"></script>
   </head>
   <script>
   function editName(obj){
	   Plugins.waitTips({title:'信息提示',content:'正在操作，请稍后...'});
	   $.post("{:U('Admin/Express/editName')}",{id:$(obj).attr('dataId'),expressCompany:obj.value},function(data,textStatus){
			var json = WST.toJson(data);
			if(json.status=='1'){
				Plugins.setWaitTipsMsg({content:'操作成功',timeout:1000});
			}else{
				Plugins.closeWindow();
				Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
			}
		});
   }
   function toggleIsShow(t,v){
	   Plugins.waitTips({title:'信息提示',content:'正在操作，请稍后...'});
	   $.post("{:U('Admin/Express/editiIsShow')}",{id:v,isShow:t},function(data,textStatus){
			var json = WST.toJson(data);
			if(json.status=='1'){
				Plugins.setWaitTipsMsg({content:'操作成功',timeout:1000,callback:function(){
				    location.reload();
				}});
			}else{
				Plugins.closeWindow();
				Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
			}
	   });
   }
  function toggleIsEnable(t,v){
     Plugins.waitTips({title:'信息提示',content:'正在操作，请稍后...'});
     $.post("{:U('Admin/Express/editiIsEnable')}",{id:v,isEnable:t},function(data,textStatus){
      var json = WST.toJson(data);
      if(json.status=='1'){
        Plugins.setWaitTipsMsg({content:'操作成功',timeout:1000,callback:function(){
            location.reload();
        }});
      }else{
        Plugins.closeWindow();
        Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
      }
     });
   }
   function del(id){
	   Plugins.confirm({title:'信息提示',content:'您确定要删除该物流信息吗?',okText:'确定',cancelText:'取消',okFun:function(){
		   Plugins.closeWindow();
		   Plugins.waitTips({title:'信息提示',content:'正在操作，请稍后...'});
		   $.post("{:U('Admin/Express/del')}",{id:id},function(data,textStatus){
				var json = WST.toJson(data);
				if(json.status=='1'){
					Plugins.setWaitTipsMsg({content:'操作成功',timeout:1000,callback:function(){
					    location.reload();
					}});
				}else{
					Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
				}
			});
		    return false;
	   }});
   }
   function loadChildTree(obj,pid,objId){
		var str = objId.split("_");
		level = (str.length-2);
		if($(obj).hasClass('glyphicon-minus')){
			$(obj).removeClass('glyphicon-minus').addClass('glyphicon-plus');
			$('tr[class^="'+objId+'"]').hide();
		}else{
			$(obj).removeClass('glyphicon-plus').addClass('glyphicon-minus');
			$('tr[class^="'+objId+'"]').show();
			$('tr[class^="'+objId+'"] > td >.glyphicon-plus').each(function(){
				$(this).removeClass('glyphicon-plus').addClass('glyphicon-minus');
			})
		}
	}
   </script>
   <body class='wst-page'>
       <div class='wst-tbar' style='text-align:right;height:25px;'>
 
       <a class="btn btn-success glyphicon glyphicon-plus" href="{:U('Admin/Express/toEdit')}" style='float:right'>新增</a>
  
       </div>
       <div class='wst-body'> 
        <table class="table table-hover table-striped table-bordered wst-list">
           <thead>
             <tr>
               <th width="40">序号</th>
               <th width="100">物流名称</th>
               <th width="80">物流拼音</th>
               <th width='100'>查询电话</th>
               <th width='180'>官方网址</th>
               <th width='60'>商户显示</th>
               <th width='60'>启用状态</th>
               <th width='120'>操作</th>
             </tr>
           </thead>
           <tbody>
            <volist name="List['root']" id="vo" key='i'>
             <tr id='tr_0_{$i}' class="tr_0" isLoad='1'>
               <td>{$i}</td>
               <td width="20">
               <input style="width:200px" type='text' value='{$vo['expressCompany']}' onchange='javascript:editName(this)' dataId="{$vo.id}" class='form-control wst-ipt'/>
               </td>
               <td>{$vo['pinyin']}</td>
               <td>{$vo['telephone']}</td>
               <td>{$vo['website']}</td>
               <td>
               <div class="dropdown">
               <if condition="$vo['isEnable']==0 ">
                   <button class="btn btn-danger dropdown-toggle wst-btn-dropdown"  type="button" data-toggle="dropdown">
               隐藏
            <span class="caret"></span>
           </button>
               <else/>
                   <button class="btn btn-success dropdown-toggle wst-btn-dropdown" type="button" data-toggle="dropdown">
               显示
            <span class="caret"></span>
           </button>
               </if>
                   <ul class="dropdown-menu" role="menu">
            <li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:toggleIsEnable(1,{$vo['id']})">显示</a></li>
            <li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:toggleIsEnable(0,{$vo['id']})">隐藏</a></li>
           </ul>
               </div>
               </td>
               <td>
               <div class="dropdown">
               <if condition="$vo['isShow']==0 ">
                   <button class="btn btn-danger dropdown-toggle wst-btn-dropdown"  type="button" data-toggle="dropdown">
					     禁用
					  <span class="caret"></span>
				   </button>
               <else/>
                   <button class="btn btn-success dropdown-toggle wst-btn-dropdown" type="button" data-toggle="dropdown">
					     启用
					  <span class="caret"></span>
				   </button>
               </if>
                   <ul class="dropdown-menu" role="menu">
					  <li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:toggleIsShow(1,{$vo['id']})">启用</a></li>
					  <li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:toggleIsShow(0,{$vo['id']})">禁用</a></li>
				   </ul>
               </div>
               </td>
               <td>
               <a class="btn btn-default glyphicon glyphicon-pencil" href="{:U('Admin/Express/toEdit',array('id'=>$vo['id']))}">修改</a>&nbsp;
               <a class="btn btn-default glyphicon glyphicon-trash" onclick="javascript:del({$vo['id']},0)">刪除</a>
               </td>
             </tr>
             </volist>
                          <tr>
                <td colspan='10' align='center'>{$List['pager']}</td>
             </tr>
           </tbody>
        </table>
       </div>
   </body>
</html>